<template>
  <div class="nucleicacidSelectAllList">
    <el-container>
      <el-main>
        <el-table :data="productArr">
          <el-table-column type="index" label="编号" width="50"></el-table-column>
          <el-table-column label="姓名" prop="userId" width="150"></el-table-column>
          <el-table-column label="核酸检测预约时间" prop="nucleicAcidTestAppointmentTime" width="200"></el-table-column>
          <el-table-column label="核酸检测开始时间" prop="nucleicAcidTestStartTime" width="250"></el-table-column>
          <el-table-column label="核酸检测结束时间" prop="nucleicAcidTestEndTime" width="200"></el-table-column>
          <el-table-column label="地址" prop="address" width="100"></el-table-column>
          <el-table-column label="结果" prop="result" width="100"></el-table-column>
          <!--*******************************-->
          <el-table-column label="移除">
            <!--scope代表每行对应的数据里面的index属性代表下标,
            里面的row代表每行对应的数组中的对象-->
            <template slot-scope="scope">
              <!--confirm确认事件-->
              <el-popconfirm @confirm="productDelete(scope.$index, scope.row)"
                             title="确定移除这个记录吗？">
                <el-button size="mini"
                           type="danger" slot="reference">移除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
          <!--*******************************-->
        </el-table>
      </el-main>
    </el-container>
  </div>
</template>

<script>
import {selectAllResult} from "@/api/admin_api";
import {WorkUser} from "@/api/admin_api";
import {setToken} from "@/utils/Token";

export default {
  name: "nucleicacid-appointment-list",
  data(){
    return{
      productArr:[],

    }
  },

  created() {
    //setToken('token','eyJjdHkiOiJIUzI1NiIsInR5cCI6IkpXVCIsImFsZyI6IkhTMjU2In0.eyJuZXRJZCI6OCwiaWRlbnRpdHkiOjIsIm5ldFBhc3N3b3JkIjoiJDJhJDEwJDlMRXdsZ3VXc3RWV2MyMmhtcVNUcU9mNUpqdnJiRHc5ZU9oRVd2bHovYU5vd2J5V1RKMk1DIiwiY29tbXVuaXR5SWQiOjEsImV4cCI6MTY2NDU0Mzk0NywiYWNjb3VudCI6IjUwMzA2MTM2NUBxcS5jb20ifQ.zYRy4ld5-J0WRCyGI4bX-sMGiHX6jGHITyQLvtXM6Mc')
    selectAllResult().then((res)=>{
      this.productArr = res.data.data;
      for (let i = 0;i<this.productArr.length;i++){
         WorkUser(this.productArr[i].userId).then((res)=>{
           this.productArr[i].userId = res.data.data.userName;
         })
      }
    })
  },
  methods: {
    productDelete(){

    },

    clickSort(ind){

      vegetableList(this.vegetableSort[ind].name).then((res)=>{
        this.productArr = res.data.data;
      })
    }

  }
}
</script>

<style >

.nucleicacidSelectAllList .el-table .cell{
  text-align: center;
}

.nucleicacidSelectAllList .vegetable-sort .el-menu-item{
  text-align: center;
}
</style>